package practiceProjects;

import java.io.File;
import java.util.Objects;
import java.util.Random;

/**
 * @Project ：learn_java
 * @File ：RandomChooseAMovie.java
 * @IDE ：IntelliJ IDEA
 * @Author ：自由如风间
 * @Date ：2025/4/26 07:16
 * @Description ：从文件夹中随机选一部电影，专治选择困难症
 */


public class RandomChooseAMovie {
    public static void main(String[] args) {
        String basePath = "D:\\__videos\\片\\没看过的";
        File file = new File(basePath);
        Random random = new Random();

        File[] requireNonNull = Objects.requireNonNull(file.listFiles());
        int i = random.nextInt(requireNonNull.length);
        System.out.println(requireNonNull[i]);
    }
}
